package com.sky.config;

import com.sky.properties.SnowFlakeProperties;
import com.sky.utils.SnowFlake;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置类，用于创建AliOssUtil对象
 */
@Configuration
@Slf4j
public class SnowFlakeConfiguration {

    @Bean
    public SnowFlake snowFlake(SnowFlakeProperties snowFlakeProperties){
        return new SnowFlake(snowFlakeProperties.getWorkerId(),
                snowFlakeProperties.getDatacenterId(),
                snowFlakeProperties.getSequence());
    }
}